import java.awt.print.Book;
import java.util.Scanner;

public class text {
    static String[] password = new String[10];
    static String[] user = new String[10];
    static int people = 0;

    public static void main(String[] args) {
        user[0] = "11";
        password[0] = "123456";
        for (int is = 0; is < 10000; is++) {
            System.out.println("欢迎来到龙院图书管理系统");
            System.out.println("1.登录   2.注册");
            Scanner scan = new Scanner(System.in);
            int a = scan.nextInt();
            if (a == 1) {
                for (int aa = 1; aa < 10000000; aa++) {
                    System.out.println("请输入用户名:");
                    Scanner scan1 = new Scanner(System.in);
                    String b = scan1.next();
                    if (b.equals(user[0])) {
                        System.out.println("请输入密码:");
                        Scanner scan2 = new Scanner(System.in);
                        String c = scan2.next();
                        if (c.equals(password[0])) {
                            System.out.println("恭喜登入成功");
                            System.out.println(user[0] + "欢迎来到龙院书籍管理系统");
                            break;
                        } else {
                            System.out.println("输入错误，请重新输入");
                        }
                    } else {
                        System.out.println("输入错误，请重新输入");
                    }
                }
            }
            if (a == 2) {
                System.out.println("请输入你的部门:");
                Scanner scan3 = new Scanner(System.in);
                String aaaa = scan3.next();
                System.out.println("请输入用户名:");
                Scanner scan4 = new Scanner(System.in);
                String aaa = scan4.next();
                user use = new user();
                use.User(aaa);
                System.out.println("请输入密码:");
                String bbb = scan4.next();
                user use1 = new user();
                use1.Password(bbb);
                people++;
                if (people < user.length) {
                    password[people] = aaa;
                    user[people] = bbb;
                }
                System.out.println("完成注册");
                System.out.println("1.登录   2.注册");
                Scanner scan5 = new Scanner(System.in);
                a = scan5.nextInt();
                if (a == 1) {
                    System.out.println("请输入用户名:");
                    Scanner scan1 = new Scanner(System.in);
                    String b = scan1.next();
                    System.out.println("请输入密码:");
                    Scanner scan2 = new Scanner(System.in);
                    String c = scan2.next();
                    for (int i = 0; i < user.length; i++) {
                        if (b.equals(user[i])) {
                            if (password[i].equals(c) && password[i].equals(c)) {
                                System.out.println("恭喜登入成功");
                                System.out.println(user[i] + "欢迎来到龙院书籍管理系统");
                                break;
                            } else {
                                System.out.println("输入错误，请重新输入");
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < 100000000; i++) {
                System.out.println("请输入数字进行选择； 1图书管理  2出版社管理  3退出登录  4退出系统");
                Scanner l = new Scanner(System.in);
                int k = l.nextInt();
                for (int v = 0; v < 100000000; v++) {
                    if (k == 1) {
                        System.out.println("请输入  1增加 2删除 3更新 4查询 5返回上一菜单");
                        Scanner m = new Scanner(System.in);
                        int mm = m.nextInt();
                        if (mm == 1) {
                            book BOOK = new book();
                            BOOK.insert();
                        }
                        if (mm == 2) {
                            book BOOK1 = new book();
                            BOOK1.delete();
                        }
                        if (mm == 3) {
                            book BOOK2 = new book();
                            BOOK2.update();
                        }
                        if (mm == 4) {
                            book BOOK3 = new book();
                            BOOK3.inquire();
                        }
                        if (mm == 5) {
                            break;
                        }
                    }
                }
                for(int isi=0;isi<100000;isi++) {
                    if (k == 2) {
                        System.out.println("请输入  1增加 2删除 3更新 4根据出版社名字查询 5查询所有出版社 6返回上一菜单");
                        publica BOOK4 = new publica();
                        Scanner m = new Scanner(System.in);
                        int mm = m.nextInt();
                        if (mm == 1) {
                            publica BOOK = new publica();
                            BOOK.insert();
                        }
                        if (mm == 2) {
                            publica BOOK1 = new publica();
                            BOOK1.delete();
                        }
                        if (mm == 3) {
                            publica BOOK2 = new publica();
                            BOOK2.update();
                        }
                        if (mm == 4) {
                            publica BOOK3 = new publica();
                            BOOK3.inquire();
                        }
                        if (mm == 5) {
                            publica BOOK3 = new publica();
                            BOOK3.inquires();
                        }
                        if (mm == 6) {
                            break;
                        }

                    }
                    if (k == 3) {
                        break;

                    }
                    if(k==4){
                        System.exit(1);
                    }
                }
                if (k == 3) {
                    break;
                }
            }
        }
    }
}